package data;

import java.util.Vector;

public class MirroringGDWithBS implements MirroringGraphData {
	
	private double _bufferSize;
	private double _price;
	private Vector<Integer> _timeUnitsID;
	private double _energy;
	private int _timeUnitsTotalnumber; 

    public MirroringGDWithBS(double size){
        _bufferSize = size;
        _price = -1;
        _energy =-1;
        _timeUnitsID =  null;
        _timeUnitsTotalnumber = -1;
    }
	public MirroringGDWithBS(double size, double price, 
			Vector<Integer> unitsID, double energy, int tuTotal) {
		_bufferSize = size;
		_price = price;
		_timeUnitsID = unitsID;
		_energy=energy;
		_timeUnitsTotalnumber = tuTotal;
		}

	public double get_bufferSize() {
		return _bufferSize;
	}

	public double get_price() {
		return _price;
	}

	public Vector<Integer> get_timeUnitsID() {
		return _timeUnitsID;
	}

	public double get_energy() {
		return _energy;
	}
	
	public int get_timeUnitsTotalnumber() {
		return _timeUnitsTotalnumber;
	}

     @Override
    public String toString() {
         StringBuilder res = new StringBuilder("Mirroring with Buffer of Size: "+_bufferSize+" Output: \n");
         if (_price == -1 ){
             return res.append("	Buffer Size too Small \n").toString();
         }
        res.append("	Price: "+_price + ", Power: "+_energy+"\n");
        if(_timeUnitsID.size()>0)
        	res.append("	Active Time Units (on those time units the storage machine is on): \n	");

        for(int i = 0; i<_timeUnitsID.size(); i++){
        	if(i==_timeUnitsID.size()-1)
        		res.append(_timeUnitsID.get(i).toString()+"\n");
        	else res.append(_timeUnitsID.get(i).toString()+", ");
        }
        res.append("	the machine was active in "+_timeUnitsID.size()+" time units out of "+_timeUnitsTotalnumber+" time units");
        return res.toString();
    }
	@Override
	public boolean isEmpty() {
		
		return _timeUnitsID==null;
	}
	
	

}
